<?php
/*
Plugin Name: content-types
Plugin URI: http://wp-jacob.googlecode.com
Description: Implements content types in wordpress
Version: 0.1-2
Author: Jacob Brunson
Author URI: http://jacobbrunson.com
*/

/*  Copyright 2008  Jacob Brunson  (email : wp-jacob.gpl.license@jacobbrunson.com )

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/

include_once(dirname(__FILE__).'/ContentType.class.php');

function conttype_editor($arg)
{
//    error_log($arg);
    return $arg;
}
add_filter('the_editor', 'conttype_editor');

function conttype_display($arg)
{
    global $post;
    $content_type = get_post_meta($post->ID, 'content_type', true);
    if ($content_type == '') {
        return $arg;
    }
    $ct = new ContentType($arg);
    return $arg;
}
add_filter('the_content', 'conttype_display', 1);